Security News
vlt Debuts New JavaScript Package Manager and Serverless Registry at NodeConf EU
vlt introduced its new package manager and a serverless registry this week, innovating in a space where npm has stagnated.
mock-property
Advanced tools
Given an object and a property, replaces a property descriptor (or deletes it), and returns a thunk to restore it.
Given an object and a property, replaces a property descriptor (or deletes it), and returns a thunk to restore it.
var mockProperty = require('mock-property');
var assert = require('assert');
var i = 0;
var object = {
a: 1,
get b() {
i += 1;
return 'b ' + i;
}
};
assert.equal(object.a, 1);
assert.equal(object.b, 'b 1');
assert.equal(object.b, 'b 2');
var restoreA = mockProperty(object, 'a', { 'delete': true });
assert.equal('a' in object, false);
var restoreB = mockProperty(object, 'b', { value: 42 });
assert.equal(object.b, 42);
restoreA();
assert.equal('a' in object, true);
restoreB();
assert.equal(object.b, 'b 3');
Simply clone the repo, npm install
, and run npm test
Please email @ljharb or see https://tidelift.com/security if you have a potential security vulnerability to report.
v1.1.0 - 2024-08-06
605c32e
848be58
369d824
9994626
@ljharb/eslint-config
, aud
, npmignore
, object-inspect
, tape
ebfaf9a
2deaf72
define-data-property
, has-property-descriptors
, hasown
e9f503d
aud
to npm audit
f5e6ce2
sideEffects
flag 2089940
FAQs
Given an object and a property, replaces a property descriptor (or deletes it), and returns a thunk to restore it.
The npm package mock-property receives a total of 84,300 weekly downloads. As such, mock-property popularity was classified as popular.
We found that mock-property demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
vlt introduced its new package manager and a serverless registry this week, innovating in a space where npm has stagnated.
Security News
Research
The Socket Research Team uncovered a malicious Python package typosquatting the popular 'fabric' SSH library, silently exfiltrating AWS credentials from unsuspecting developers.
Security News
At its inaugural meeting, the JSR Working Group outlined plans for an open governance model and a roadmap to enhance JavaScript package management.